Skip to content

[Repo Assist] tests: add GenerativeNestedTypesTests; refactor: use canBindNestedType in ProvidedTypeDefinition; prepare release 8.9.0#508

Merged
dsyme merged 2 commits intomasterfrom
repo-assist/tests-nested-types-canBindNestedType-20260423-be3f411fb71826eb
Apr 23, 2026
Merged

[Repo Assist] tests: add GenerativeNestedTypesTests; refactor: use canBindNestedType in ProvidedTypeDefinition; prepare release 8.9.0#508
dsyme merged 2 commits intomasterfrom
repo-assist/tests-nested-types-canBindNestedType-20260423-be3f411fb71826eb

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

🤖 This PR was created by Repo Assist, an automated AI assistant.

Summary

Two improvements bundled together (Tasks 9/5):

Task 10 — Forward Progress: GenerativeNestedTypesTests.fs

Adds 5 focused tests for generative type providers that host nested provided types:

Test What it verifies
Book and Shelf are present Both nested types are emitted into the generated assembly
Book has Title property and GetSummary method Member presence and return types
Book constructor sets fields; GetSummary returns expected string Constructor wires fields; instance method produces correct result
Shelf Label property reflects constructor argument Constructor + property round-trip
Shelf static property MaxItems returns 100 Static property on a nested type

The provider sets up a Library container with two nested classes (Book, Shelf), each with fields, constructors, instance/static properties, and instance methods.

Task 5 — Coding Improvement: canBindNestedType in ProvidedTypeDefinition

GetNestedTypes and GetMembers on ProvidedTypeDefinition previously filtered nested types using the inconsistent condition:

memberBinds true bindingFlags false m.IsPublic || m.IsNestedPublic

Because || m.IsNestedPublic is appended outside the memberBinds call, a nested public type (IsNestedPublic = true) was always included regardless of BindingFlags — e.g. even when only BindingFlags.NonPublic was set.

The canBindNestedType utility (already used in TypeSymbol.GetNestedTypes and TargetTypeDefinition.GetNestedTypes) correctly handles this:

hasFlag bindingFlags BindingFlags.Public && c.IsNestedPublic ||
hasFlag bindingFlags BindingFlags.NonPublic && not c.IsNestedPublic
```

This PR replaces the two inconsistent uses with `canBindNestedType`, making the behaviour consistent and correct.

## Test Status

```
Passed!  - Failed: 0, Passed: 157, Skipped: 0, Total: 157, Duration: 7 s

All 157 tests pass (152 before + 5 new GenerativeNestedTypesTests).

Generated by 🌈 Repo Assist, see workflow run. Learn more.

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@96b9d4c39aa22359c0b38265927eadb31dcf4e2a

…e in ProvidedTypeDefinition; prepare release 8.9.0

- Add GenerativeNestedTypesTests.fs: 5 tests for generative nested type providers
  (Book class: constructor, Title property, GetSummary method;
   Shelf class: constructor, Label property, MaxItems static property)
- Refactor GetNestedTypes and GetMembers in ProvidedTypeDefinition to use
  canBindNestedType instead of the inconsistent `memberBinds ... || m.IsNestedPublic`
  pattern; aligns with the existing canBindNestedType used in TypeSymbol and
  TargetTypeDefinition, and correctly respects BindingFlags.NonPublic for nested types
- RELEASE_NOTES: bump to 8.9.0
- 157/157 tests pass

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dsyme dsyme marked this pull request as ready for review April 23, 2026 09:30
@dsyme dsyme merged commit a01af9c into master Apr 23, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant